package com.lego.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.lego.bean.Conment;
import com.lego.bean.Reviews;
import com.lego.service.ReviewsService;
import com.lego.service.impl.ReviewsServiceImpl;

@WebServlet("/selectConment")
public class SelectCmtServlet  extends HttpServlet{
	private ReviewsService rev=new ReviewsServiceImpl();
	ObjectMapper om = new ObjectMapper();
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setContentType("application/json;charset=utf-8");
		List<Conment> list=rev.selectCmt();
		
		 resp.getWriter().write(om.writeValueAsString(list));
	}
}
